home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2004 April / Gamestar_61_2004-04_dvdb.iso / DVDStar / Editace / hltp.exe / {app} / Source Code / CZBindMaker / PrivateSettings / SettingCollection.cs < prev    next >
Text File  |  2003-10-10  |  3KB  |  94 lines

  1. /*****************************************************************************
  2.   Copyright ⌐ 2003 by Martin Cook. All rights are reserved. If you like this 
  3.   code then feel free to go ahead and use it. The only thing I ask is that 
  4.   you don't remove or alter my copyright notice. Your use of this software 
  5.   is entirely at your own risk. I make no claims or warrantees about the 
  6.   reliability or fitness of this code for any particular purpose. If you 
  7.   make changes or additions to this code please mark your code as being 
  8.   yours. If you have questions or comments then please contact me at: 
  9.   martinc@outdrs.net
  10.   
  11.   Have Fun! :o)
  12. *****************************************************************************/
  13.  
  14. using System;
  15. using System.Collections;
  16.  
  17. namespace PrivateSettings
  18. {
  19.     
  20.     /// <summary>
  21.     /// A collection of Setting objects.
  22.     /// </summary>
  23.     public class SettingCollection : CollectionBase
  24.     {
  25.     
  26.         // *******************************************************************
  27.         // Constructors.
  28.         // *******************************************************************
  29.  
  30.         public SettingCollection()
  31.         {
  32.  
  33.         } // End SettingCollection()
  34.  
  35.         // *******************************************************************
  36.         // Public methods.
  37.         // *******************************************************************
  38.  
  39.         public Setting this[int index]
  40.         {
  41.             get {return List[index] as Setting;}
  42.             set {List[index] = value;}
  43.         } // End indexer
  44.  
  45.         // *******************************************************************
  46.  
  47.         public int this[Setting item]
  48.         {
  49.             get {return List.IndexOf(item);}
  50.         } // End indexer
  51.  
  52.         // *******************************************************************
  53.  
  54.         public int Add(Setting item)
  55.         {
  56.             return List.Add(item);
  57.         } // End Add()
  58.  
  59.         // *******************************************************************
  60.  
  61.         public void AddRange(Setting[] items)
  62.         {
  63.             lock(List.SyncRoot)
  64.             {
  65.                 for (int i = 0; i < items.Length; i++)
  66.                     List.Add(items[i]);
  67.             } // End lock block
  68.         } // End AddRange()
  69.  
  70.         // *******************************************************************
  71.  
  72.         public void Remove(Setting item)
  73.         {
  74.             List.Remove(item);
  75.         } // End Remove()
  76.  
  77.         // *******************************************************************
  78.  
  79.         public new void Clear()
  80.         {
  81.             List.Clear();
  82.         } // End Clear()
  83.  
  84.         // *******************************************************************
  85.  
  86.         public int IndexOf(Setting item)
  87.         {
  88.             return List.IndexOf(item);
  89.         } // End IndexOf()
  90.     
  91.     } // End class SettingCollection
  92.  
  93. } // End namespace PrivateSettings
  94.